<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <div id="app">
        姓：<input type="text" v-model="firstName" /> <br/>
        名: <input type="text" v-model="lastName" /> <br/>
        全名：<span>{{fullName}}</span>
    </div>

    <script>
        new Vue({
            el:'#app',
            data:{
                firstName: '张',
                lastName: '三',
                fullName: '张-三'
            },
            watch:{
                firstName(val){
                    setTimeout(() => {
                        this.fullName = val + '-' + this.lastName
                    })
                },
                lastName(val){
                    this.fullName = this.firstName + '-' + val
                }
            }
        })
    </script>
</body>
</html>